<?php
class Post extends AppModel {
	var $name = 'Post';
	var $order = 'Post.created DESC';
	
	var $actsAs = array(
		'Sluggable' => array(
			'length' => 255,
			'translation' => 'utf-8',
		),
	);
	
	var $validate = array(
		'title' => array(
			'rule' => VALID_NOT_EMPTY,
			'message' => 'Please enter a title.',
		),
	);
	
	var $hasMany = array(
		'Comment' => array(
			'className' => 'Comment',
			'foreignKey' => 'post_id',
		),
	);
	
	var $hasAndBelongsToMany = array(
		'Tag' => array(
			'className' => 'Tag',
			'joinTable' => 'posts_tags',
			'foreignKey' => 'post_id',
			'associationForeignKey' => 'tag_id',
			'order' => 'Tag.title ASC',
			'unique' => true,
		),
	);
}
?>